package com.shanzmoo.admin.web;

import com.shanzmoo.base.bean.PageRespBase;
import com.shanzmoo.base.bean.SHttpResponse;
import com.shanzmoo.base.bean.SResponse;
import com.shanzmoo.core.manager.DeliveryManager;
import com.shanzmoo.db.logistics.entity.query.DeliveryBillPageQuery;
import com.shanzmoo.db.logistics.entity.vo.DeliveryBillInfoVO;
import com.shanzmoo.db.logistics.entity.vo.DeliveryBillPageVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * <p>
 * 发货单 前端控制器
 * </p>
 *
 * @author Gzhao
 * @since 2020-12-16
 */
@Slf4j
@Api(tags = "门店-发货单管理")
@RestController
@RequestMapping("logistics")
public class DeliveryBillController {

    @Autowired
    private DeliveryManager deliveryManager;

    @ApiOperation(value = "分页列表")
    @PostMapping("/pageList")
    public SHttpResponse<PageRespBase<DeliveryBillPageVO>> pageList(@Valid @RequestBody DeliveryBillPageQuery query) {
        SResponse<PageRespBase<DeliveryBillPageVO>> re = deliveryManager.getPageList(query);
        return SHttpResponse.transform(re);
    }

    @ApiOperation(value = "发货单明细")
    @GetMapping("/details")
    public SHttpResponse<DeliveryBillInfoVO> getDatails(@RequestParam Integer id) {
        SResponse<DeliveryBillInfoVO> re = deliveryManager.getDatails(id);
        return SHttpResponse.transform(re);
    }



}
